//=============================================================================
// ThermoBlasterFire.
//=============================================================================
class ThermoBlasterFire extends TFProjectileFire;

function DrawMuzzleFlash(Canvas Canvas)
{
	if (FlashEmitter != None)
	        FlashEmitter.SetRotation(Weapon.Rotation);
        Weapon.Hand=1;
	if (FlashEmitter != None)
	        FlashEmitter.SetLocation(Weapon.GetEffectStart());
	Super.DrawMuzzleFlash(Canvas);
}

function Projectile SpawnProjectile(Vector Start, Rotator Dir)
{
//    local ThermoBlasterProjectile Proj;
    local Projectile Proj;

    Start += Vector(Dir);
//    Proj = Spawn(class'ThermoBlasterProjectile',,, Start, Dir);
    Proj = TFThermoBlaster(Weapon).SpawnProjectile(Start, Dir);
//    Recoil();

    return Proj;
}

function FlashMuzzleFlash()
{
    if (FlashEmitter != None)
    {
    FlashEmitter.Skins[0] = FinalBlend'TFMedia.ThermoMuzProjRedFB';
    }
    Super.FlashMuzzleFlash();
}

event ModeDoFire()
{
    if (Instigator.Role < ROLE_Authority || Level.NetMode == NM_DedicatedServer){
    Default.ProjSpawnOffset.X = -20; ProjSpawnOffset.X = -20;}

    Recoil();
    Super.ModeDoFire();
}

function ServerPlayFiring()
{
    FireSound = default.FireSound;
    Super.ServerPlayFiring();
}

function PlayFiring()
{
    FireSound = default.FireSound;

    Weapon.PlayOwnedSound(FireSound,SLOT_Interact,TransientSoundVolume,,,Default.FireAnimRate/FireAnimRate,false);

    ClientPlayForceFeedback(FireForce);  // jdf

    FireCount++;
}

simulated function ModeTick(float dt)
{
if (FlashEmitter != None)
    {
    FlashEmitter.Skins[0] = FinalBlend'TFMedia.ThermoMuzProjRedFB';
    }
}


function Recoil()
{
    local Rotator NewRotation;
    local float NewPitch, NewYaw;

    if ( (Instigator != None) && Instigator.IsFirstPerson()){
    NewPitch = int(Frand()*75); NewYaw = int(Frand()*125);
    if (Frand() > 0.5) NewYaw *= -1;
    if (Frand() > 0.5) NewPitch *= -1;
    NewRotation = Instigator.GetViewRotation();
    NewRotation.Pitch += NewPitch;
    NewRotation.Yaw += NewYaw;
    Instigator.SetViewRotation(NewRotation);}
}

defaultproperties
{
     ProjSpawnOffset=(X=45.000000,Y=22.000000,Z=-18.000000)
     bModeExclusive=False
     FireAnim=
     FireLoopAnim=
     FireEndAnim=
     FireSound=Sound'ONSVehicleSounds-S.LaserSounds.Laser08'
     NoAmmoSound=Sound'WeaponSounds.BaseGunTech.BSeekLost1'
     FireRate=0.075000
     AmmoClass=Class'Taskforces.ThermoBlasterAmmo'
     AmmoPerFire=1
     ShakeRotMag=(X=50.000000,Y=50.000000,Z=50.000000)
     ShakeRotRate=(X=10000.000000,Y=10000.000000,Z=10000.000000)
     ShakeRotTime=2.000000
     ShakeOffsetMag=(X=1.000000,Y=1.000000,Z=1.000000)
     ShakeOffsetRate=(X=1000.000000,Y=1000.000000,Z=1000.000000)
     ShakeOffsetTime=2.000000
     ProjectileClass=Class'Taskforces.ThermoBlasterProjectile'
     BotRefireRate=0.990000
     FlashEmitterClass=Class'Taskforces.ThermoMuzFlashProj1st'
}
